/*
 * proc_events.h
 *
 * Created: 17.09.2013 3:13:40
 *  Author: evgen
 */ 


#ifndef PROC_EVENTS_H_
#define PROC_EVENTS_H_

#define PUBLISH_EVENT(event) Exec_writeEventFifo(event)
#define PUBLISH_FAST_EVENT(event) fastEventBitmask |= event

///#include "avr/io.h"

typedef struct __tagDriveConst_t{
	uint8_t length;
	uint8_t dir;
	uint8_t minpwm;
	uint8_t maxpwm;
	int8_t curpwm;
}DriveConst_t;

void Exec_run(void);
void FlashLeds(void);
void InitBaseIO(void);

/* Extern Data */
extern unsigned char fastEventBitmask;
extern unsigned char Exec_eventFifo[];
extern volatile unsigned char Exec_eventFifoHead;
extern volatile unsigned char Exec_eventFifoTail;
extern uint8_t encodersMode, lastecodersMode;
extern uint32_t tenc0, tenc1;
extern uint32_t enc0, enc1;
void Exec_writeEventFifo(unsigned char event);
extern uint16_t calEvTime;		// time for calibration
extern uint8_t dvg0_cal_val, dvg1_cal_val, enc_calibr, enc_calibr_idx;
extern DriveConst_t dvg0, dvg1;
#endif /* PROC_EVENTS_H_ */